﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using BaMusaSoft.RPS.DataModel;

namespace BaMusaSoft.RPS.ViewModel.Infrastructure
{
    public class SearchSchedule : INotifyPropertyChanged
    {
        private ObservableCollection<Schedule> _result;
        private bool _showResult;

        public SearchSchedule(IEnumerable<Schedule> result)
        {
            Result = new ObservableCollection<Schedule>(result);
        }

        public bool ShowResult
        {
            get { return _showResult; }
            set
            {
                _showResult = value;
                RaisePropertyChanged("ShowResult");
            }
        }

        public ObservableCollection<Schedule> Result
        {
            get { return _result; }
            private set
            {
                _result = value;
                RaisePropertyChanged("Result");
            }
        }

        #region Implementation of INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        private void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}